﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace FindDomains
{
    public class UniqueArrayList : ArrayList {
        /**
         * Only add the object if there is not
         * another copy of it in the list
         */
        public int add(Object obj)
        {
            for (int i = 0; i < this.Count; i++) 
            {
                if (obj.Equals(this[i])) 
                {
                    return -1;
                }
            }
            return this.Add(obj);
        }
        
        public bool addAll(ICollection c) 
        {
            bool result = true;
            foreach (Object t in c ) {
                if (add(t)<0) {
                    result = false;
                }
            }
            return result;
        }
    }

}
